Scalable query processing

ABSTRACT

Embodiments of the present disclosure may provide a dynamic query execution model. This query execution model may provide acceleration by scaling out parallel parts of a query (also referred to as a fragment) to additional computing resources, for example computing resources leased from a pool of computing resources. Execution of the parts of the query may be coordinated by a parent query coordinator, where the query originated, and a fragment query coordinator.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a Continuation of U.S. patent application Ser. No.17/823,572, filed Aug. 31, 2022, which is a Continuation of U.S. patentapplication Ser. No. 17/657,257, filed Mar. 30, 2022 and now issued asU.S. Pat. No. 11,461,326, which is a Continuation of U.S. patentapplication Ser. No. 16/889,033 filed Jun. 1, 2020, and now issued asU.S. Pat. No. 11,347,735, the contents of which are incorporated hereinby reference in their entireties.

TECHNICAL FIELD

The present disclosure generally relates to scalable query processingusing parallel processing.

BACKGROUND

As the world becomes more data driven, database systems and other datasystems are storing more and more data. For a business to use this data,different operations or queries are typically run on this large amountof data. Some operations, such as those including large table scans, cantake a substantial amount of time to execute on a large amount of data.The time to execute such operations can be proportional to the number ofcomputing resources used for execution, so time can be shortened byusing more computing resources.

To this end, some data systems can provide a pool of computingresources, and those resources can be assigned to execute differentoperations. However, in such systems, the assigned computing resourcestypically work in conjunction (for example as a process group). Hence,their assignments are fixed and static. Because the assigned computingresources work together to execute the operation, they are typicallyassigned their respective part at the outset, e.g., roles andassignments are fixed ahead of time. Therefore, these systems are notflexible regarding dynamic changes in the number of available resources.

Moreover, these systems cannot track the performance of all of thecomputing resources. Therefore, in the event of an error with one of thecomputing resources, the entire job would have to be re-performed,wasting time and resources.

BRIEF DESCRIPTION OF THE DRAWINGS

Various ones of the appended drawings merely illustrate exampleembodiments of the present disclosure and should not be considered aslimiting its scope.

FIG. 1 illustrates an example computing environment in which anetwork-based data warehouse system can implement streams on shareddatabase objects, according to some example embodiments.

FIG. 2 is a block diagram illustrating components of a compute servicemanager, according to some example embodiments.

FIG. 3 is a block diagram illustrating components of an executionplatform, according to some example embodiments.

FIG. 4 is a block diagram illustrating a foreground global service,according to some example embodiments.

FIG. 5 shows a flow diagram for executing a query, according to someexample embodiments.

FIG. 6 shows an example of a query plan, according to some exampleembodiments.

FIG. 7 shows an example of a revised query plan, according to someexample embodiments.

FIG. 8 is a block diagram of a query processing system, according tosome example embodiments.

FIG. 9 shows an example of input-to-output mapping, according to someexample embodiments.

FIG. 10 is a block diagram of a fragment processing system, according tosome example embodiments.

FIG. 11 shows an example of a fragment plan using checkpoints, accordingto some example embodiments.

FIG. 12 is a block diagram of a fragment processing environment,according to some example embodiments.

FIG. 13 shows a flow diagram for tracking batch processing, according tosome example embodiments.

FIG. 14 illustrates a diagrammatic representation of a machine in theform of a computer system within which a set of instructions may beexecuted for causing the machine to perform any one or more of themethodologies discussed herein, in accordance with some embodiments ofthe present disclosure.

DETAILED DESCRIPTION

The description that follows includes systems, methods, techniques,instruction sequences, and computing machine program products thatembody illustrative embodiments of the disclosure. In the followingdescription, for the purposes of explanation, numerous specific detailsare set forth in order to provide an understanding of variousembodiments of the inventive subject matter. It will be evident,however, to those skilled in the art, that embodiments of the inventivesubject matter may be practiced without these specific details. Ingeneral, well-known instruction instances, protocols, structures, andtechniques are not necessarily shown in detail.

Embodiments of the present disclosure may provide a dynamic queryexecution model. This query execution model may provide acceleration byscaling out parallel parts of a query (also referred to as a fragment)to additional computing resources, such as those leased from a pool ofcomputing resources. Execution of the parts of the query may becoordinated by a parent query coordinator (where the query originated)and a fragment query coordinator. Files for the query may loaded in ashared file queue as a continuous scanset, from which the parent querycoordinator and fragment coordinator can request batches of filesserially (e.g., one at a time) as they complete processing theircurrently assigned batch. The fragment computing resources may generatematerialized results and load them into another shared file queue. Thematerialized results may be consumed by the parent query coordinatorsubsequent to all files in the continuous scanset being processed. Thisquery execution model therefore provides increased speed as well asflexibility, especially when the number of resources can dynamicallychange during the query execution.

FIG. 1 illustrates an example shared data processing platform 100implementing secure messaging between deployments, in accordance withsome embodiments of the present disclosure. To avoid obscuring theinventive subject matter with unnecessary detail, various functionalcomponents that are not germane to conveying an understanding of theinventive subject matter have been omitted from the figures. However, askilled artisan will readily recognize that various additionalfunctional components may be included as part of the shared dataprocessing platform 100 to facilitate additional functionality that isnot specifically described herein.

As shown, the shared data processing platform 100 comprises thenetwork-based data warehouse system 102, a cloud computing storageplatform 104 (e.g., a storage platform, an AWS® service, MicrosoftAzure®, or Google Cloud Services®), and a remote computing device 106.The network-based data warehouse system 102 is a network-based systemused for storing and accessing data (e.g., internally storing data,accessing external remotely located data) in an integrated manner, andreporting and analysis of the integrated data from the one or moredisparate sources (e.g., the cloud computing storage platform 104). Thecloud computing storage platform 104 comprises a plurality of computingmachines and provides on-demand computer system resources such as datastorage and computing power to the network-based data warehouse system102. While in the embodiment illustrated in FIG. 1 , a data warehouse isdepicted, other embodiments may include other types of databases orother data processing systems.

The remote computing device 106 (e.g., a user device such as a laptopcomputer) comprises one or more computing machines (e.g., a user devicesuch as a laptop computer) that execute a remote software component 108(e.g., browser accessed cloud service) to provide additionalfunctionality to users of the network-based data warehouse system 102.The remote software component 108 comprises a set of machine-readableinstructions (e.g., code) that, when executed by the remote computingdevice 106, cause the remote computing device 106 to provide certainfunctionality. The remote software component 108 may operate on inputdata and generates result data based on processing, analyzing, orotherwise transforming the input data. As an example, the remotesoftware component 108 can be a data provider or data consumer thatenables database tracking procedures, such as streams on shared tablesand views, as discussed in further detail below.

The network-based data warehouse system 102 comprises an accessmanagement system 110, a compute service manager 112, an executionplatform 114, and a database 116. The access management system 110enables administrative users to manage access to resources and servicesprovided by the network-based data warehouse system 102. Administrativeusers can create and manage users, roles, and groups, and usepermissions to allow or deny access to resources and services. Theaccess management system 110 can store shared data that securely managesshared access to the storage resources of the cloud computing storageplatform 104 amongst different users of the network-based data warehousesystem 102, as discussed in further detail below.

The compute service manager 112 coordinates and manages operations ofthe network-based data warehouse system 102. The compute service manager112 also performs query optimization and compilation as well as managingclusters of computing services that provide compute resources (e.g.,virtual warehouses, virtual machines, EC2 clusters). The compute servicemanager 112 can support any number of client accounts such as end usersproviding data storage and retrieval requests, system administratorsmanaging the systems and methods described herein, and othercomponents/devices that interact with compute service manager 112.

The compute service manager 112 is also coupled to database 116, whichis associated with the entirety of data stored on the shared dataprocessing platform 100. The database 116 stores data pertaining tovarious functions and aspects associated with the network-based datawarehouse system 102 and its users.

In some embodiments, database 116 includes a summary of data stored inremote data storage systems as well as data available from one or morelocal caches. Additionally, database 116 may include informationregarding how data is organized in the remote data storage systems andthe local caches. Database 116 allows systems and services to determinewhether a piece of data needs to be accessed without loading oraccessing the actual data from a storage device. The compute servicemanager 112 is further coupled to an execution platform 114, whichprovides multiple computing resources (e.g., virtual warehouses) thatexecute various data storage and data retrieval tasks, as discussed ingreater detail below.

Execution platform 114 is coupled to multiple data storage devices 124-1to 124-n that are part of a cloud computing storage platform 104. Insome embodiments, data storage devices 124-1 to 124-n are cloud-basedstorage devices located in one or more geographic locations. Forexample, data storage devices 124-1 to 124-n may be part of a publiccloud infrastructure or a private cloud infrastructure. Data storagedevices 124-1 to 124-n may be hard disk drives (HDDs), solid statedrives (SSDs), storage clusters, Amazon S3 storage systems or any otherdata storage technology. Additionally, cloud computing storage platform104 may include distributed file systems (such as Hadoop DistributedFile Systems (HDFS)), object storage systems, and the like.

The execution platform 114 comprises a plurality of compute nodes (e.g.,virtual warehouses). A set of processes on a compute node executes aquery plan compiled by the compute service manager 112. The set ofprocesses can include: a first process to execute the query plan; asecond process to monitor and delete micro-partition files using a leastrecently used (LRU) policy, and implement an out of memory (OOM) errormitigation process; a third process that extracts health informationfrom process logs and status information to send back to the computeservice manager 112; a fourth process to establish communication withthe compute service manager 112 after a system boot; and a fifth processto handle all communication with a compute cluster for a given jobprovided by the compute service manager 112 and to communicateinformation back to the compute service manager 112 and other computenodes of the execution platform 114.

The cloud computing storage platform 104 also comprises an accessmanagement system 118 and a web proxy 120. As with the access managementsystem 110, the access management system 118 allows users to create andmanage users, roles, and groups, and use permissions to allow or denyaccess to cloud services and resources. The access management system 110of the network-based data warehouse system 102 and the access managementsystem 118 of the cloud computing storage platform 104 can communicateand share information so as to enable access and management of resourcesand services shared by users of both the network-based data warehousesystem 102 and the cloud computing storage platform 104. The web proxy120 handles tasks involved in accepting and processing concurrent APIcalls, including traffic management, authorization and access control,monitoring, and API version management. The web proxy 120 provides HTTPproxy service for creating, publishing, maintaining, securing, andmonitoring APIs (e.g., REST APIs).

In some embodiments, communication links between elements of the shareddata processing platform 100 are implemented via one or more datacommunication networks. These data communication networks may utilizeany communication protocol and any type of communication medium. In someembodiments, the data communication networks are a combination of two ormore data communication networks (or sub-networks) coupled to oneanother. In alternative embodiments, these communication links areimplemented using any type of communication medium and any communicationprotocol.

As shown in FIG. 1 , data storage devices 124-1 to 124-N are decoupledfrom the computing resources associated with the execution platform 114.That is, new virtual warehouses can be created and terminated in theexecution platform 114 and additional data storage devices can becreated and terminated on the cloud computing storage platform 104 in anindependent manner. This architecture supports dynamic changes to thenetwork-based data warehouse system 102 based on the changing datastorage/retrieval needs as well as the changing needs of the users andsystems accessing the shared data processing platform 100. The supportof dynamic changes allows network-based data warehouse system 102 toscale quickly in response to changing demands on the systems andcomponents within network-based data warehouse system 102. Thedecoupling of the computing resources from the data storage devices124-1 to 124-n supports the storage of large amounts of data withoutrequiring a corresponding large amount of computing resources.Similarly, this decoupling of resources supports a significant increasein the computing resources utilized at a particular time withoutrequiring a corresponding increase in the available data storageresources. Additionally, the decoupling of resources enables differentaccounts to handle creating additional compute resources to process datashared by other users without affecting the other users' systems. Forinstance, a data provider may have three compute resources and sharedata with a data consumer, and the data consumer may generate newcompute resources to execute queries against the shared data, where thenew compute resources are managed by the data consumer and do not affector interact with the compute resources of the data provider.

Compute service manager 112, database 116, execution platform 114, cloudcomputing storage platform 104, and remote computing device 106 areshown in FIG. 1 as individual components. However, each of computeservice manager 112, database 116, execution platform 114, cloudcomputing storage platform 104, and remote computing environment may beimplemented as a distributed system (e.g., distributed across multiplesystems/platforms at multiple geographic locations) connected by APIsand access information (e.g., tokens, login data). Additionally, each ofcompute service manager 112, database 116, execution platform 114, andcloud computing storage platform 104 can be scaled up or down(independently of one another) depending on changes to the requestsreceived and the changing needs of shared data processing platform 100.Thus, in the described embodiments, the network-based data warehousesystem 102 is dynamic and supports regular changes to meet the currentdata processing needs.

During typical operation, the network-based data warehouse system 102processes multiple jobs (e.g., queries) determined by the computeservice manager 112. These jobs are scheduled and managed by the computeservice manager 112 to determine when and how to execute the job. Forexample, the compute service manager 112 may divide the job intomultiple discrete tasks and may determine what data is needed to executeeach of the multiple discrete tasks. The compute service manager 112 mayassign each of the multiple discrete tasks to one or more nodes of theexecution platform 114 to process the task. The compute service manager112 may determine what data is needed to process a task and furtherdetermine which nodes within the execution platform 114 are best suitedto process the task. Some nodes may have already cached the data neededto process the task (due to the nodes having recently downloaded thedata from the cloud computing storage platform 104 for a previous job)and, therefore, be a good candidate for processing the task. Metadatastored in the database 116 assists the compute service manager 112 indetermining which nodes in the execution platform 114 have alreadycached at least a portion of the data needed to process the task. One ormore nodes in the execution platform 114 process the task using datacached by the nodes and, if necessary, data retrieved from the cloudcomputing storage platform 104. It is desirable to retrieve as much dataas possible from caches within the execution platform 114 because theretrieval speed is typically much faster than retrieving data from thecloud computing storage platform 104.

As shown in FIG. 1 , the shared data processing platform 100 separatesthe execution platform 114 from the cloud computing storage platform104. In this arrangement, the processing resources and cache resourcesin the execution platform 114 operate independently of the data storagedevices 124-1 to 124-n in the cloud computing storage platform 104.Thus, the computing resources and cache resources are not restricted tospecific data storage devices 124-1 to 124-n. Instead, all computingresources and all cache resources may retrieve data from, and store datato, any of the data storage resources in the cloud computing storageplatform 104.

FIG. 2 is a block diagram illustrating components of the compute servicemanager 112, in accordance with some embodiments of the presentdisclosure. As shown in FIG. 2 , a request processing service 202manages received data storage requests and data retrieval requests(e.g., jobs to be performed on database data). For example, the requestprocessing service 202 may determine the data necessary to process areceived query (e.g., a data storage request or data retrieval request).The data may be stored in a cache within the execution platform 114 orin a data storage device in cloud computing storage platform 104. Amanagement console service 204 supports access to various systems andprocesses by administrators and other system managers. Additionally, themanagement console service 204 may receive a request to execute a joband monitor the workload on the system. The stream share engine 225manages change tracking on database objects, such as a data share (e.g.,shared table) or shared view, according to some example embodiments, andas discussed in further detail below.

The compute service manager 112 also includes a job compiler 206, a joboptimizer 208, and a job executor 210. The job compiler 206 parses a jobinto multiple discrete tasks and generates the execution code for eachof the multiple discrete tasks. The job optimizer 208 determines thebest method to execute the multiple discrete tasks based on the datathat needs to be processed. The job optimizer 208 also handles variousdata pruning operations and other data optimization techniques toimprove the speed and efficiency of executing the job. The job executor210 executes the execution code for jobs received from a queue ordetermined by the compute service manager 112.

A job scheduler and coordinator 212 sends received jobs to theappropriate services or systems for compilation, optimization, anddispatch to the execution platform 114. For example, jobs may beprioritized and processed in that prioritized order. In an embodiment,the job scheduler and coordinator 212 determines a priority for internaljobs that are scheduled by the compute service manager 112 with other“outside” jobs such as user queries that may be scheduled by othersystems in the database but may utilize the same processing resources inthe execution platform 114. In some embodiments, the job scheduler andcoordinator 212 identifies or assigns particular nodes in the executionplatform 114 to process particular tasks. A virtual warehouse manager214 manages the operation of multiple virtual warehouses implemented inthe execution platform 114. As discussed below, each virtual warehouseincludes multiple execution nodes that each include a cache and aprocessor (e.g., a virtual machine, an operating system level containerexecution environment).

Additionally, the compute service manager 112 includes a configurationand metadata manager 216, which manages the information related to thedata stored in the remote data storage devices and in the local caches(i.e., the caches in execution platform 114). The configuration andmetadata manager 216 uses the metadata to determine which datamicro-partitions need to be accessed to retrieve data for processing aparticular task or job. A monitor and workload analyzer 218 overseesprocesses performed by the compute service manager 112 and manages thedistribution of tasks (e.g., workload) across the virtual warehouses andexecution nodes in the execution platform 114. The monitor and workloadanalyzer 218 also redistributes tasks, as needed, based on changingworkloads throughout the network-based data warehouse system 102 and mayfurther redistribute tasks based on a user (e.g., “external”) queryworkload that may also be processed by the execution platform 114. Theconfiguration and metadata manager 216 and the monitor and workloadanalyzer 218 are coupled to a data storage device 220. Data storagedevice 220 in FIG. 2 represent any data storage device within thenetwork-based data warehouse system 102. For example, data storagedevice 220 may represent caches in execution platform 114, storagedevices in cloud computing storage platform 104, or any other storagedevice.

FIG. 3 is a block diagram illustrating components of the executionplatform 114, in accordance with some embodiments of the presentdisclosure. As shown in FIG. 3 , execution platform 114 includesmultiple virtual warehouses, which are elastic clusters of computeinstances, such as virtual machines. In the example illustrated, thevirtual warehouses include virtual warehouse 1, virtual warehouse 2, andvirtual warehouse n. Each virtual warehouse (e.g., EC2 cluster) includesmultiple execution nodes (e.g., virtual machines) that each include adata cache and a processor. The virtual warehouses can execute multipletasks in parallel by using the multiple execution nodes. As discussedherein, execution platform 114 can add new virtual warehouses and dropexisting virtual warehouses in real time based on the current processingneeds of the systems and users. This flexibility allows the executionplatform 114 to quickly deploy large amounts of computing resources whenneeded without being forced to continue paying for those computingresources when they are no longer needed. All virtual warehouses canaccess data from any data storage device (e.g., any storage device incloud computing storage platform 104).

Although each virtual warehouse shown in FIG. 3 includes three executionnodes, a particular virtual warehouse may include any number ofexecution nodes. Further, the number of execution nodes in a virtualwarehouse is dynamic, such that new execution nodes are created whenadditional demand is present, and existing execution nodes are deletedwhen they are no longer necessary (e.g., upon a query or jobcompletion).

Each virtual warehouse is capable of accessing any of the data storagedevices 124-1 to 124-n shown in FIG. 1 . Thus, the virtual warehousesare not necessarily assigned to a specific data storage device 124-1 to124-n and, instead, can access data from any of the data storage devices124-1 to 124-n within the cloud computing storage platform 104.Similarly, each of the execution nodes shown in FIG. 3 can access datafrom any of the data storage devices 124-1 to 124-n. For instance, thestorage device 124-1 of a first user (e.g., provider account user) maybe shared with a worker node in a virtual warehouse of another user(e.g., consumer account user), such that the other user can create adatabase (e.g., read-only database) and use the data in storage device124-1 directly without needing to copy the data (e.g., copy it to a newdisk managed by the consumer account user). In some embodiments, aparticular virtual warehouse or a particular execution node may betemporarily assigned to a specific data storage device, but the virtualwarehouse or execution node may later access data from any other datastorage device.

In the example of FIG. 3 , virtual warehouse 1 includes three executionnodes 302-1, 302-2, and 302-n. Execution node 302-1 includes a cache304-1 and a processor 306-1. Execution node 302-2 includes a cache 304-2and a processor 306-2. Execution node 302-n includes a cache 304-n and aprocessor 306-n. Each execution node 302-1, 302-2, and 302-n isassociated with processing one or more data storage and/or dataretrieval tasks. For example, a virtual warehouse may handle datastorage and data retrieval tasks associated with an internal service,such as a clustering service, a materialized view refresh service, afile compaction service, a storage procedure service, or a file upgradeservice. In other implementations, a particular virtual warehouse mayhandle data storage and data retrieval tasks associated with aparticular data storage system or a particular category of data.

Similar to virtual warehouse 1 discussed above, virtual warehouse 2includes three execution nodes 312-1, 312-2, and 312-n. Execution node312-1 includes a cache 314-1 and a processor 316-1. Execution node 312-2includes a cache 314-2 and a processor 316-2. Execution node 312-nincludes a cache 314-n and a processor 316-n. Additionally, virtualwarehouse 3 includes three execution nodes 322-1, 322-2, and 322-n.Execution node 322-1 includes a cache 324-1 and a processor 326-1.Execution node 322-2 includes a cache 324-2 and a processor 326-2.Execution node 322-n includes a cache 324-n and a processor 326-n.

In some embodiments, the execution nodes shown in FIG. 3 are statelesswith respect to the data the execution nodes are caching. For example,these execution nodes do not store or otherwise maintain stateinformation about the execution node, or the data being cached by aparticular execution node. Thus, in the event of an execution nodefailure, the failed node can be transparently replaced by another node.Since there is no state information associated with the failed executionnode, the new (replacement) execution node can easily replace the failednode without concern for recreating a particular state.

Although the execution nodes shown in FIG. 3 each include one data cacheand one processor, alternative embodiments may include execution nodescontaining any number of processors and any number of caches.Additionally, the caches may vary in size among the different executionnodes. The caches shown in FIG. 3 store, in the local execution node(e.g., local disk), data that was retrieved from one or more datastorage devices in cloud computing storage platform 104 (e.g., S3objects recently accessed by the given node). In some exampleembodiments, the cache stores file headers and individual columns offiles as a query downloads only columns necessary for that query.

To improve cache hits and avoid overlapping redundant data stored in thenode caches, the job optimizer 208 assigns input file sets to the nodesusing a consistent hashing scheme to hash over table file names of thedata accessed (e.g., data in database 116 or database 122). Subsequentor concurrent queries accessing the same table file will therefore beperformed on the same node, according to some example embodiments.

As discussed, the nodes and virtual warehouses may change dynamically inresponse to environmental conditions (e.g., disaster scenarios),hardware/software issues (e.g., malfunctions), or administrative changes(e.g., changing from a large cluster to smaller cluster to lower costs).In some example embodiments, when the set of nodes changes, no data isreshuffled immediately. Instead, the least recently used replacementpolicy is implemented to eventually replace the lost cache contents overmultiple jobs. Thus, the caches reduce or eliminate the bottleneckproblems occurring in platforms that consistently retrieve data fromremote storage systems. Instead of repeatedly accessing data from theremote storage devices, the systems and methods described herein accessdata from the caches in the execution nodes, which is significantlyfaster and avoids the bottleneck problem discussed above. In someembodiments, the caches are implemented using high-speed memory devicesthat provide fast access to the cached data. Each cache can store datafrom any of the storage devices in the cloud computing storage platform104.

Further, the cache resources and computing resources may vary betweendifferent execution nodes. For example, one execution node may containsignificant computing resources and minimal cache resources, making theexecution node useful for tasks that require significant computingresources. Another execution node may contain significant cacheresources and minimal computing resources, making this execution nodeuseful for tasks that require caching of large amounts of data. Yetanother execution node may contain cache resources providing fasterinput-output operations, useful for tasks that require fast scanning oflarge amounts of data. In some embodiments, the execution platform 114implements skew handling to distribute work amongst the cache resourcesand computing resources associated with a particular execution, wherethe distribution may be further based on the expected tasks to beperformed by the execution nodes. For example, an execution node may beassigned more processing resources if the tasks performed by theexecution node become more processor-intensive. Similarly, an executionnode may be assigned more cache resources if the tasks performed by theexecution node require a larger cache capacity. Further, some nodes maybe executing much slower than others due to various issues (e.g.,virtualization issues, network overhead). In some example embodiments,the imbalances are addressed at the scan level using a file stealingscheme. In particular, whenever a node process completes scanning itsset of input files, it requests additional files from other nodes. Ifthe one of the other nodes receives such a request, the node analyzesits own set (e.g., how many files are left in the input file set whenthe request is received), and then transfers ownership of one or more ofthe remaining files for the duration of the current job (e.g., query).The requesting node (e.g., the file stealing node) then receives thedata (e.g., header data) and downloads the files from the cloudcomputing storage platform 104 (e.g., from data storage device 124-1),and does not download the files from the transferring node. In this way,lagging nodes can transfer files via file stealing in a way that doesnot worsen the load on the lagging nodes.

Although virtual warehouses 1, 2, and n are associated with the sameexecution platform 114, the virtual warehouses may be implemented usingmultiple computing systems at multiple geographic locations. Forexample, virtual warehouse 1 can be implemented by a computing system ata first geographic location, while virtual warehouses 2 and n areimplemented by another computing system at a second geographic location.In some embodiments, these different computing systems are cloud-basedcomputing systems maintained by one or more different entities.

Additionally, each virtual warehouse is shown in FIG. 3 as havingmultiple execution nodes. The multiple execution nodes associated witheach virtual warehouse may be implemented using multiple computingsystems at multiple geographic locations. For example, an instance ofvirtual warehouse 1 implements execution nodes 302-1 and 302-2 on onecomputing platform at a geographic location and implements executionnode 302-n at a different computing platform at another geographiclocation. Selecting particular computing systems to implement anexecution node may depend on various factors, such as the level ofresources needed for a particular execution node (e.g., processingresource requirements and cache requirements), the resources availableat particular computing systems, communication capabilities of networkswithin a geographic location or between geographic locations, and whichcomputing systems are already implementing other execution nodes in thevirtual warehouse.

Execution platform 114 is also fault tolerant. For example, if onevirtual warehouse fails, that virtual warehouse is quickly replaced witha different virtual warehouse at a different geographic location.

A particular execution platform 114 may include any number of virtualwarehouses. Additionally, the number of virtual warehouses in aparticular execution platform is dynamic, such that new virtualwarehouses are created when additional processing and/or cachingresources are needed. Similarly, existing virtual warehouses may bedeleted when the resources associated with the virtual warehouse are nolonger necessary.

In some embodiments, the virtual warehouses may operate on the same datain cloud computing storage platform 104, but each virtual warehouse hasits own execution nodes with independent processing and cachingresources. This configuration allows requests on different virtualwarehouses to be processed independently and with no interferencebetween the requests. This independent processing, combined with theability to dynamically add and remove virtual warehouses, supports theaddition of new processing capacity for new users without impacting theperformance observed by the existing users.

FIG. 4 shows an example foreground global service (GS) 400, according tosome example embodiments. The foreground GS 400 may receive queryrequests and develop query plans to execute the query requests. Theforeground GS 400 may broker requests to computing nodes or resourcesthat execute a query plan, as explained in further detail herein. Theforeground GS 400 may include query coordinators (QCs) 402.1-402.3,which are coupled to a local background service (BG) 404. In anembodiment, the foreground GS 400 may be defined for a particular typeof service, such as copy, ingest, compute, large table scan, and soforth. The QCs 402.1-402.3 may receive query requests from differentsources, which may have different account IDs. For certain operations,such as those involving multiple computing resources working together toexecute different portions of an operation (e.g., large table scans),the source may be defined at a data warehouse level granularity. The QCs402.1-402.3 may communicate information regarding the query requests andtheir sources to the local BG 404.

As explained in further detail below, the local BG 404 may assigncomputing resources (also sometimes referred to as execution platforms(XP)) to the QCs 402.1-402.3. The computing resources may be computingnodes allocated to the foreground GS 400 from a pool of computingresources. In an embodiment, the computing resources may be machines,servers, and/or processors. In an embodiment, the computing resourcesmay be processing cores of a machine. Upon receiving their assignmentsof computing resources, the QCs 402.1-402.3 may communicate directlywith the assigned computing resources to execute respective query plans.

The number of assigned computing resources may vary and changedynamically, even during execution of a query. For example, the numberof assigned computing resources may be dynamically allocated using thetechniques described in U.S. patent application Ser. No. 16/874,388,entitled “Flexible Computing,” filed on May 14, 2020, which isincorporated herein by reference in its entirety, including but notlimited to those portions that specifically appear hereinafter, theincorporation by reference being made with the following exception: Inthe event that any portion of the above-referenced application isinconsistent with this application, this application supersedes theabove-referenced application.

FIG. 5 shows a flow diagram of a method 500 for executing a query by aforeground GS, according to some example embodiments. In an embodiment,a QC within the foreground GS may perform portions of the method 500. Atoperation 505, the QC or foreground GS may receive a query request to berun on a data set, such as a table. The QC receiving the query may bereferred to as a parent QC. At operation 510, the parent QC may create aquery plan to execute the received query. The query plan may include aplurality of operators and links connecting the operators; the links maydefine how the results of one operator are communicated to the nextoperator.

FIG. 6 illustrates an example query plan 600, according to some exampleembodiments. The query plan 600 is shown for a filter-aggregate querytype for illustration purposes only, and the query plan 600 may be othertypes of queries as explained below. The query plan 600 may include aplurality of operators to execute the query: a table scan operator 605,a filter operator 610, a local aggregation operator 615, a finalaggregation operator 620, and a result operator 625. The operators maybe connected by links, shown in the example as “L,” “X,” and “S” types.As shown, the results of the table scan operator 605 may be communicatedusing a local link (“L” link) to the filter operator 610. That is, acomputing resource may perform the table scan operator 605, filteroperator 610, and local aggregation operator 615 without communicatingwith another computing resource. In contrast, the results of the localaggregation operator 615 may be communicated using an exchange (“X”link) with the final aggregation operator 620. And results of the finalaggregation operator 610 may be communicated using a single link (“S”link) to the result operator 625. Both the exchange and single link mayrequire communication between computing resources; thus, those connectedoperators may not be performed by an independent computing resourcewithout communicating with other resources.

Returning to method 500 of FIG. 5 , after a query plan is created,eligible portions of the query plan for fragment processing may beidentified at operation 515. A fragment refers to parts of a query planthat may be performed using additional computing resources in parallel(and in isolation), i.e., a parallelizable part of a query plan. A setof criteria may be used to identify a portion or portions of the queryplan that may be eligible for fragment processing. In an embodiment, apiece of a plan, which may include an operator or set of operators, withonly local links may be eligible for fragment processing. Additionally,that operator or set of operators may begin with a table scan operationto be eligible for fragment processing. Because only local links connectthe identified operations, the computing resource may execute thoseidentified operations without communicating with other resources,thereby making it eligible for fragment processing. For example, thoseoperations may include operations that can be executed locally by acomputing resource on a data in a database, data set, a micropartition,or the like. Examples of such operators may include, but are not limitedto, tables can, filter, child aggregation, projection, bloom filter, andso forth.

Consider the example of query plan 600 of FIG. 6 . There, the firstthree operators (the table scan operator 605, the filter operator 610,and the local aggregate operator 615) may be eligible for fragmentprocessing because they are connected by local links, i.e., they can beperformed by a computing resource independently without communicatingwith other computing resources, and begin with a table scan operator.

Another criterion for fragment processing eligibility may be increasedprocessing speed. That is, the criterion may be based on whether usingfragment processing with additional computing resources would yieldfaster execution as compared to normal execution (i.e., without fragmentprocessing). In an embodiment, this determination may not rely on aminimum number of additional computing resources because that number maybe dynamic and change during the execution of the query as explainedabove. Because of the dynamic nature of the number of computingresources, the speed of query processing may not be static or defined,but may be dependent on the number of available computing resources.Thus, the time for executing the same query using fragment processingmay vary at different times depending on the number of availablecomputing resources at the time of execution.

Other criterion for fragment processing eligibility may also be used todetermine eligibility for fragment processing, such as the size of thetable scan, the output to input ratio, availability of leased computingresources, and so forth. Larger table scans may be more appropriate forfragment processing. Output to input ratio refers to the size of theoutput of the fragment processing as compared to the input of thefragment processing. As explained below, the output of the computingresources is not directly pipelined into the parent QC, but may beprovided in the form of materialized results, which the parent scans(e.g., parent job execution platform machine). Hence, the output mayrefer to the size of the materialized result and the input may refer tothe size of the input files used to generate the materialized result.The smallerthe output to input ratio, the more appropriate that portionof the query plan may be for fragment processing.

At operation 520, the query plan may be revised to add fragmentprocessing for the identified operations of the original query plan. Aquery may include multiple fragments. For the sake of clarity andbrevity, an example case of a query plan with a single fragment isdescribed next, but it should be understood that these teachings can beextended to multiple fragments in a query plan.

FIG. 7 illustrates a revised query plan 700 with fragment processing forthe query plan 600, according to some example embodiments. As discussedabove, operators 605-610 may have been identified for fragmentprocessing. Therefore, for certain files or batches of files, operators605-610 may be performed by the parent QC, as explained above. Thoseoperations may also be concurrently performed by a fragment QC usingadditional computing resources (e.g., leased computing resources). Theparent QC and fragment QC may be provided as different QCs but may scanthe same table (e.g., operator 605). They may scan different aspects orportions of the table as explained below. The fragment QC may receiveand execute the fragment steps (e.g., operators 605-615) of the revisedquery plan.

The output of those operators by fragment processing may be provided asmaterialized results and may be stored, as shown in operation 705. Forexample, the materialized results may be stored in a storage location,such as a cloud storage, and a materialized result file list may bestored in a memory (e.g., an output shared file queue). As such,fragment computing resources may not need to communicate with the parentQC or with each other. The fragment computing resources may not bedirectly linked to the parent QC so that their operations may beindependent of other components.

The revised query plan 700 may also include a scan operator 710 forscanning the stored materialized results by the parent QC; a localaggregation operator 715 for aggregating the scanned materializedresults; and a union all operation 720 for joining the results ofoperators 605-615 performed by the parent QC and the results of localaggregation 715 (e.g., aggregated scanned materialized results). In anembodiment, the union all operation 720 may first consume the resultsfrom the left branch (operators 605-615) and after that, it may consumethe results of the right branch (operators 705-715). By starting withthe left branch related to the parent query and then switching toprocessing the materialized results from the right branch, the revisedquery plan ensures that all files in the continuous scanset areprocessed and there is no performance penalty for using fragmentprocessing.

Moreover, aggregating the materialized results locally at operator 715first may reduce the amount of data needed for union all operator 720.Hence, this local aggregation may provide another opportunity to reducedata, as fragment processing may have a small reduction factor. Therevised query plan 700 may also include remaining portions of the queryplan 600, e.g., the final aggregation operator 620 and a result operator625, as discussed above.

Returning again to method 500 in FIG. 5 , the revised query plan maythen be executed. At operation 525, files from the data set may beloaded as a continuous scanset in an input shared file queue (SFQ) tofacilitate parent and fragment processing. The input SFQ may be providedin a memory accessible by the parent QC and fragment QC. As described infurther detail below (with reference to FIG. 8 ), at operations 530 and535, the input SFQ may provide files from the continuous scanset to boththe parent and fragment QCs for processing in a serial fashion, e.g.,one or more batches at a time. Using batches, which are a set of files,may reduce the amount of REST calls from the fragment computingresources. The parent QC may use its assigned computing resources(parent computing resources) to process its assigned files, and thefragment QC may use leased computing resources (fragment computingresources) to process its assigned files.

Assignment of files from the input SFQ may be performed in batches usinga continuous scanset instead of fixed assignments. That is, both theparent and fragment QCs (and their computing resources) may be coupledto the input SFQ, and the computing resources for each of the parent andfragment QCs may request a batch of files (e.g., a group of files) fromthe input SFQ when they have availability (e.g., when they havecompleted processing their currently assigned batch). The parent QC maycoordinate with its assigned computing resources to execute assignedbatch(es), and the fragment QC may coordinate with its assignedcomputing resources to execute its assigned batch(es). The input SFQ mayassign the next batch to the requesting computing resource for arespective QC. A QC's computing resource, for example, may request anext batch after it has processed its current batch and when it hasavailability to process a next batch. For example, the SFQ may assign abatch of files to respective computing resources for each of the parentand fragment QCs and then assign subsequent batches to the computingresources for each of the QCs upon requests until all files in thecontinuous scanset have been assigned.

This batching technique provides flexibility as the number of fragmentcomputing resources may increase or decrease during a query execution.This batching technique, as opposed to fixed assignment techniques, doesnot rely on the availability of all computing resources for the entireduration of the query execution. For example, in the event fragmentcomputing resources become unavailable during the query execution, theparent QC (and its computing resources) may continue processing thefiles in the continuous scanset. That is, if the fragment QC (and itscomputing resources) can no longer process any more batches, the parentQC (and its computing resources) may continue its batch processing (oneat a time) until all files in the continuous scanset are processed.Therefore, the results of the execution will remain the same, but thetime to execute the query may increase when fragment computing resourcesare lost during the execution of the query (as compared to the time whenthe fragment computing resources are available).

Also, at operation 535, the results of the fragment processing may beprovided as materialized results, which are stored in a storage area(e.g., cloud storage), and the file list for the materialized results(e.g., URLs) may be stored in an output SFQ, where they are availablefor the parent QC to access. At operation 540, after the entirecontinuous scanset (e.g., the files in the input SFQ) has been processedby the computing resources for the parent and/or fragment QC, the parentQC computing resource may read or scan the materialized results, processthe scanned materialized results, and combine them with the batchresults of the files processed by the parent QC (e.g., operators 705-720of the revised query plan in FIG. 7 ). At operation 545, the parent QCmay complete coordination of the execution of the query and provideresults. For example, the parent QC may coordinate the execution ofanyremaining portions of the revised query plan (e.g., operators 620 and625 of FIG. 7 ) on the combined results.

FIG. 8 shows an example of a query processing system 800, according tosome example embodiments. The query processing system 800 may include aparent QC 805, a fragment QC 810, an input SFQ 815, and an output SFQ820. In an embodiment, the input and output SFQ 815, 820 may be providedin a local memory accessible by the parent QC 805 and the fragment QC810.

The parent QC 805 may create a query plan using fragment processing asdescribed herein. The parent QC 805 may coordinate with its assignedcomputing resources to execute the query according to the query plan.The fragment QC 810 may coordinate with its assigned computing resourcesto execute the fragment portions of the query plan.

The scanset for the query may be divided into files and those files maybe stored in the input SFQ 815 as a continuous scanset. The parent QC805 and the fragment QC 810 may request files from the input SFQ 815 forprocessing. In response, the input SFQ 815 may combine a set of files ina batch, assign the batch a unique batch ID, and then assign or transferthat batch to the requesting QC.

In the example shown in FIG. 8 , the parent QC 805 may have receivedbatch 101 from the input shared queue 815; batch 101 includes files T₁₀and T₁₁. When the parent QC 805 completes processing batch 101 and (itscomputing resource) generates results for that batch, it may requestmore files from the input SFQ 815. At that time, the input SFQ 815 maycombine another set of files in a batch with its own unique batch ID andassign or transfer that batch to the parent QC 805.

Likewise, in the example shown in FIG. 8 , the fragment QC 810 may havereceived batch 102 from the input SFQ 815; batch 102 includes files T₁₃and T₁₄. When the fragment QC 810 completes processing batch 102, it mayrequest more files from the input SFQ 815. At that time, the input SFQ815 may combine another set of files in a batch with its own uniquebatch ID and assign or transfer that batch to the fragment QC 810. Thisprocess of requesting and processing batches serially by the parent andfragment QC may continue until all files in the continuous scanset areprocessed.

However, in the event the computing resources assigned to the fragmentQC 810 (leased computing resources) have been recalled, the fragment QCmay allow that computing resource to complete its processing of itscurrent batch and may then release the recalled computing resources.Consequently, the fragment QC 810 may not request more files from theinput SFQ 815 for that computing resource, and the parent QC 805 may bethe only entity requesting and processing the files in the continuousscanset if there are no more fragment computing resources available. Ifadditional computing resources are reallocated to the fragment QC 810while the query is still being processed, it may then request files fromthe input SFQ 815 and may continue its parallel operation with theparent QC 805, as discussed above. Therefore, this scheme using acontinuous scanset in an input SFQ provides robustness and flexibilityin the processing of the files when the number of available computingresources may vary during execution of a query.

Unlike the parent QC 805 which processes its assigned batches andgenerates batch results, the fragment QC 810 may process its assignedbatches and generates materialized results (which are stored in astorage area) and transmits materialized result (MR) file lists to theoutput shared queue 820. Each MR file may correspond to a single batch,and a MR file may not contain results from different batches. Thisallows tracking of batch processing and also allows for repeatingprocessing of a specific batch in the event of an error, as described infurther detail below. However, an input batch may result in the outputof several MR files. For example, if an input batch is large and theoutput does not fit into one MR file, the output may be divided intoseveral MR files.

The parent QC 805 may access the materialized results identified in theoutput SFQ 820. The parent QC 805 through its computing resource(s) mayprocess the materialized results (e.g., table scan) and may combine themwith the results of its processing of files from the input SFQ 815(e.g., batch results) to complete execution of the query. In anembodiment, the computing resource(s) of the parent QC 805 may beginscanning the materialized results identified in the output SFQ 820 afterall files in the continuous scanset are processed.

Another benefit of fragment processing is that it may provide more faulttolerance and more robust failure recovery techniques. By mappingmaterialized results with their input batches, the system can trackwhich input files generated which results. Therefore, if there is anerror in the processing, such as a fragment computing resource failing,the system may only need to reschedule the batch(es) provided to thefailed resource.

FIG. 9 shows an example of an input-to-output mapping, according to someexample embodiments. Illustrated here are input batches 910, 912, 914are illustrated. Each input batch 910, 912, 914 may include one or morefiles of a continuous scanset, as described herein. The input batches910, 912, 914 may be processed using fragment execution by one or morefragment computing resources. The output of the fragment execution maybe provided as MR files (also referred to as materialized batches (MB))920, 922, 924. An MR file may include only the output of the processingof a specific input batch. For example, MB 920 may include results ofthe processing of files in the input batch 910, and MB 922 may includeresults of the processing of files in the input batch 912, and so on. Ifan input batch is large and the output does not fit into one MR file,the output may be divided into several MR files, referred to as amaterialized batch (MB). However, each MR file in a MB may containresults for just one input batch.

Techniques for ensuring that each materialized result file contains datafrom only one input batch will be described next. These trackingtechniques can provide valuable metadata information such as which inputbatches have been successfully processed and have generated materializedresults, and associating respective materialized results to specificinput batch(es). This information may allow fast and efficient recoveryof a computing resource failure, for example by rescheduling thecorresponding input batch, as opposed to processing all files again.

To ensure the correct input batch to materialized results relationship,row set operator (RSO) links may be designed to be local-synchronous.That is, all data from an input batch may be contained within one RSOthread and may not interfere with other threads. This may be performedby using a local aggregator operator, as described herein. Moreover,barriers may be erected to separate data from different input batches.These barriers may be accomplished with the use of checkpoints andstaging areas, as described in further detail below.

FIG. 10 shows an example of a fragment processing system 1000, accordingto some example embodiments. The fragment processing system 1000 mayinclude a QC 1005 with a QC staging area 1010, an input SFQ 1015, afragment computing resource 1020 with a fragment staging area 1025, andan output SFQ 1030. The QC 1005 may coordinate and schedule jobs on thefragment computing resource 1020. When the fragment computing resource1020 is available to perform fragment processing, the QC 1005 mayrequest files from the input SFQ 1015.

As explained above, the requested files may be grouped in a batch andthe batch may be assigned a unique batch ID. The batch may be placed inthe QC staging area 1010. There, metadata, such as the batch ID alongwith the list of files in the batch, may be stored. The QC 1005 maytransfer the batch with the unique batch ID to the fragment computingresource 1020. The fragment computing resource 1020 may place the batchin its fragment staging area 1025. The fragment computing resource 1020may include a staging area per thread. Each fragment computing resource1020 may include a plurality of execution threads (for example, eightexecution threads). In an embodiment, the number of threads maycorrespond to the number of processing cores of the fragment computingresource. Each thread may have its own pipeline and work in parallelwithin the computing resource.

The batch ID and the list of files in the batch may be stored in thefragment staging area 1025. The fragment computing resource 1020 mayprocess the batch (e.g., execute a set of operators in a fragment plan).

As explained in further detail below, checkpoints may be employed in theoperators to maintain separation of data from different batches. Afterthe last operation is performed, a checkpoint signal may be received bythe fragment staging area 1025. The fragment staging area 1025 mayfinalize the processed batch. Also, the output of the processing may beuploaded to a storage area (e.g., cloud storage) and file lists (e.g.,URLS) may be uploaded to the output SFQ 1030 in the form of materializedresult file lists. In an embodiment, the files may be uploaded on arolling basis. The fragment staging area 1025 may also associate thematerialized files with the corresponding input batch and store thatinformation as metadata. After all of the materialized result files havebeen uploaded and the batch is finalized, the batch may be consideredfinished.

A file batch registration request may be sent from the fragmentcomputing resource 1020 to the QC 1005. In an embodiment, the file batchregistration request may be provided in a JavaScript Object Notation(JSON) format.

Hence, if a file batch registration request is not received for aparticular batch, the information for that batch ID remains in the QCstaging area 1010. Consequently, QC 1005 may reschedule that batch'sprocessing. In an embodiment, to avoid possible duplication of results,the QC 1005 may assign that batch a new, different unique batch IDbefore rescheduling it. In another embodiment, the QC 1005 may directthe processing of that batch to be performed by a parent computingresource rather than a fragment computing resource.

As discussed herein, execution of a fragment is performed throughoperators. Barriers to segregate data from different input batches maybe operator specific. For example, some operators, such as filter andprojection operators, may be stateless and thus may not implementbarriers. Other operators, such as table scan, aggregate, and insertoperators, are not stateless and may implement barriers to segregatedata from different input batches. Upon receipt of a checkpoint signal,the states of these operators may be flushed. The form of the barriersmay differ based on the operators.

FIG. 11 illustrates an example fragment plan 1100 using checkpoints,according to some example embodiments. The fragment plan 1100 mayinclude a plurality of operators to execute the fragment plan by afragment computing resource: a table scan operator 1105, a filteroperator 1110, an aggregation operator 1115, and an insert operator1120. With respect to the table scan operator 1105 asynchronousscanners, using checkpoints, may halt until all scanners are out offiles before requesting more files (or batch) from the QC. After theasynchronous scanners have scanned all files in a batch, a checkpointsignal is generated and propagated to the remaining downstream operatorswith local distribution. Each execution thread may spawn one or moreasynchronous scanners. For the purpose of creating barriers,asynchronous scanners may only interfere with fellow scanners spawnedfrom the same execution thread.

The filter operator 1110 may be stateless, so no checkpoint alterationsmay be needed and the checkpoint signal may be ignored. The aggregationoperator 1115, on the other hand, may not be stateless and may maintaina local hashtable. Using checkpoints, that local hashtable may beflushed between batches. That is, the aggregation operator 1115 mayreceive the checkpoint signal and, in response, flush its data throughthe output link, clearing the hashtable. The insert operator 1120 maybuffer data until it receives sufficient data to fill an output file(e.g., a new materialized result file). As explained in further detailbelow, the buffer may be flushed when it receives checkpoint signal atthe end of each batch.

FIG. 12 shows an example fragment processing environment with a stagingarea, according to some example embodiments. The environment may includea RSOInsert operator 1205, a fragment staging area 1210, asynchronousuploaders 1215, and a file batch registration queue 1220. As discussedabove, the fragment computing resource may include a staging area perRSO thread and a file batch registration queue shared by all RSOthreads.

The RSOInsert operator 1205 may buffer metadata for the the currentbatch (as shown), which is placed in the fragment staging area 1210.That is, the RSOInsert operator 1205 may add data to the MR file(s) forthe current batch. Upon receiving the checkpoint signal, the fragmentstaging area 1210 may finalize the current batch. The asynchronousuploaders 1215 may then upload the MR files to the storage area and theMR file lists to the output SFQ. After all the MR file have beenuploaded, the current batch may be considered finished. Next, themetadata with the batch ID for the finished batch may be placed in thefile batch registration queue, and the data for the current batch in thefragment staging area 1210 may be cleared or erased.

The file batch registration queue 1220 may receive the metadata for theMR file(s) and their corresponding batch ID. The file batch registrationqueue may then send a file batch registration request to the QC withinformation relating to the MR file(s) and their corresponding batch ID.The QC may register the files and then delete the batch ID from itsstaging area. In an embodiment, all MR files in a MB may be registeredin the same request.

In an embodiment, the file batch registration queue 1220 may have athreshold number before it sends the file batch registration request.For example, consider the example where the file batch registrationqueue 1220 has a threshold of ten files before it can send a file batchregistration request. The file batch registration queue 1220 may receivefive MR files, all corresponding to Batch ID 1. However, since five isless than ten, it may not send a file batch registration request at thistime because it has reached its ten-file threshold. Subsequently, it mayreceive an additional five MR files, all corresponding to Batch ID 2.Now the file batch registration queue 1220 has reached its ten-filethreshold. Therefore, the file batch registration queue 1220 may send afile batch registration request with the ten files, with five beingidentified for Batch ID 1 and the other five being identified for BatchID 2.

In an embodiment, the fragment staging area 1210 may be jointly owned bythe RSOInsert operator 1205 and the asynchronous uploaders 1215.Counters may be employed by each owner to determine the status of thecurrent batch. For example, the RSOInsert operator 1205 may initiallyown the new batch, and each time a new MR file is composed, a countermay be incremented. At this time, the asynchronous uploaders 1215 maytake joint ownership, and each time an MR file has finished uploading,the counter may be decremented. After the checkpoint signal is received,the RSOInsert operator 1205 may finalize the batch and release itsownership. Then, once the counter reaches zero (or negative 1), thecurrent batch may be considered finished since all files would have beenuploaded by the asynchronous uploaders 1215. The asynchronous uploaders1215 may release their ownership, and the data in the fragment stagingarea 1210 may be deleted after it has been placed in the fileregistration queue as described above.

FIG. 13 shows a flow diagram of a method 1300 for tracking input batchesto output materialized results, according to some example embodiments.As shown, portions of the method 1300 may be executed by a QC and afragment computing resource (e.g., execution platform (XP)).

At operation 1305, the fragment computing resource may request filesfrom the QC. For example, the fragment computing resource may requestfiles through a REST API or the like. At operation 1310, the QC, inresponse, may retrieve a batch of files from an input SFQ, assign thatbatch a unique batch ID, and store metadata for the batch including thebatch ID and list of files in the batch in a QC staging area. In anembodiment, if a parent computing resource requests files, the QC maynot employ the QC staging area; in that embodiment, the QC staging areamay be utilized for files requested by fragment computing resources. Atoperation 1315, the QC may send the batch assignment to the requestingfragment computing resource.

At operation 1320, the fragment computing resource may load the metadatafor that batch in its staging area. At operation 1325, the fragmentcomputing resource may perform the first operator of a fragment plan onthe files in the batch. For example, the first operator in the fragmentquery plan may be a table scan operation, so the fragment computingresource may perform a table scan operation. At operation 1330, uponcompletion of the first operator in the fragment plan, a checkpointsignal may be generated and may be propagated to the downstreamoperators in the fragment plan.

At operation 1335, the remaining parts of the fragment plan may beexecuted, with each operator receiving the checkpoint signal and takingappropriate actions if needed (e.g., flushing states). At operation1340, upon the last operator of the fragment plan being performed andthe checkpoint signal being received at the last operator, the batch maybe finalized. At operation 1345, all MR file(s) may be uploaded to astorage area and the file lists for the MR file(s) may be uploaded tothe output SFQ (e.g., via file registration). In an embodiment, the MRfile(s) may be uploaded on a rolling basis. That is, the MR file(s) maybe uploaded as they finish, and some MR file(s) may be uploaded beforethe batch is finalized.

At operation 1350, the metadata of the MR file(s) may be sent to a filebatch registration queue, and a file batch registration request may betransmitted to the QC. For example, the file batch registration requestmay be sent through a REST API or the like. The file batch registrationrequest may include information relating to the MR file(s) and theircorresponding batch ID. For example, each single-file registrationrequest may contain the batch ID to which it corresponds. In anembodiment, a list of batch IDs may be added to the request to ensurethat batches that produced empty outputs are also accounted for. Atoperation 1355, the QC may register the files in the file batchregistration request. Also, the QC may erase the information stored inits staging area regarding the batch.

The tracking techniques described herein assist in fault and errorrecovery. A QC may check the status of a computing resource in a varietyof ways. For example, if a computing resource is operating, thecomputing resource may provide its operational status to the QC. In theevent the computing resource crashes, the QC may detect the crash. Also,the computing resource may send periodic heartbeat status checks to theQC, and if the QC does not receive a heartbeat status check for aspecified time, the QC may determine an error occurred in the computingresource. Therefore, if the QC detects an error or a crash in thecomputing resource, the QC may employ the tracking techniques describedherein (e.g., using batch IDs, staging areas, and/or checkpoints) todetermine which particular batch or files to reschedule without havingto repeat performance of entire jobs.

Moreover, although some embodiments of the tracking techniques describedherein were discussed in the fragment processing context, the trackingtechniques described herein are not limited to fragment processing andcan be used in other applications. For example, the tracking techniquesdescribed herein may be used in large insert operations. A large insertoperation may be divided into batches, and the tracking techniquesdescribed herein may provide mapping of input batches and output files.Thus, if processing of one particular batch fails, the system may nothave to repeat the entire large insert operation, but rather only thefailed batch. Hence, the tracking techniques described herein mayidentify which output batch files are usable and which ones may need tobe redone in the event of some error. The tracking techniques describedherein may also be used in any suitable application, such as large datamanipulation language (DML) operations or multiple step query plans orthe like.

FIG. 14 illustrates a diagrammatic representation of a machine 1400 inthe form of a computer system within which a set of instructions may beexecuted for causing the machine 1400 to perform any one or more of themethodologies discussed herein, according to an example embodiment.Specifically, FIG. 14 shows a diagrammatic representation of the machine1400 in the example form of a computer system, within which instructions1416 (e.g., software, a program, an application, an applet, an app, orother executable code) for causing the machine 1400 to perform any oneor more of the methodologies discussed herein may be executed. Forexample, the instructions 1416 may cause the machine 1400 to execute anyone or more operations of any one or more of the methods describedherein. As another example, the instructions 1416 may cause the machine900 to implemented portions of the data flows described herein. In thisway, the instructions 1416 transform a general, non-programmed machineinto a particular machine 1400 (e.g., the remote computing device 106,the access management system 110, the compute service manager 112, theexecution platform 114, the access management system 118, the Web proxy120, remote computing device 106) that is specially configured to carryout any one of the described and illustrated functions in the mannerdescribed herein.

In alternative embodiments, the machine 1400 operates as a standalonedevice or may be coupled (e.g., networked) to other machines. In anetworked deployment, the machine 1400 may operate in the capacity of aserver machine or a client machine in a server-client networkenvironment, or as a peer machine in a peer-to-peer (or distributed)network environment. The machine 1400 may comprise, but not be limitedto, a server computer, a client computer, a personal computer (PC), atablet computer, a laptop computer, a netbook, a smart phone, a mobiledevice, a network router, a network switch, a network bridge, or anymachine capable of executing the instructions 1416, sequentially orotherwise, that specify actions to be taken by the machine 1400.Further, while only a single machine 1400 is illustrated, the term“machine” shall also be taken to include a collection of machines 1400that individually or jointly execute the instructions 1416 to performany one or more of the methodologies discussed herein.

The machine 1400 includes processors 1410, memory 1430, and input/output(I/O) components 1450 configured to communicate with each other such asvia a bus 1402. In an example embodiment, the processors 1410 (e.g., acentral processing unit (CPU), a reduced instruction set computing(RISC) processor, a complex instruction set computing (CISC) processor,a graphics processing unit (GPU), a digital signal processor (DSP), anapplication-specific integrated circuit (ASIC), a radio-frequencyintegrated circuit (RFIC), another processor, or any suitablecombination thereof) may include, for example, a processor 1412 and aprocessor 1414 that may execute the instructions 1416. The term“processor” is intended to include multi-core processors 1410 that maycomprise two or more independent processors (sometimes referred to as“cores”) that may execute instructions 1416 contemporaneously. AlthoughFIG. 14 shows multiple processors 1410, the machine 1400 may include asingle processor with a single core, a single processor with multiplecores (e.g., a multi-core processor), multiple processors with a singlecore, multiple processors with multiple cores, or any combinationthereof.

The memory 1430 may include a main memory 1432, a static memory 1434,and a storage unit 1436, all accessible to the processors 1410 such asvia the bus 1402. The main memory 1432, the static memory 1434, and thestorage unit 1436 store the instructions 1416 embodying any one or moreof the methodologies or functions described herein. The instructions1416 may also reside, completely or partially, within the main memory1432, within the static memory 1434, within the storage unit 1436,within at least one of the processors 1410 (e.g., within the processor'scache memory), or any suitable combination thereof, during executionthereof by the machine 1400.

The I/O components 1450 include components to receive input, provideoutput, produce output, transmit information, exchange information,capture measurements, and so on. The specific I/O components 1450 thatare included in a particular machine 1400 will depend on the type ofmachine. For example, portable machines such as mobile phones willlikely include a touch input device or other such input mechanisms,while a headless server machine will likely not include such a touchinput device. It will be appreciated that the I/O components 1450 mayinclude many other components that are not shown in FIG. 14 . The I/Ocomponents 1450 are grouped according to functionality merely forsimplifying the following discussion and the grouping is in no waylimiting. In various example embodiments, the I/O components 1450 mayinclude output components 1452 and input components 1454. The outputcomponents 1452 may include visual components (e.g., a display such as aplasma display panel (PDP), a light emitting diode (LED) display, aliquid crystal display (LCD), a projector, or a cathode ray tube (CRT)),acoustic components (e.g., speakers), other signal generators, and soforth. The input components 1454 may include alphanumeric inputcomponents (e.g., a keyboard, a touch screen configured to receivealphanumeric input, a photo-optical keyboard, or other alphanumericinput components), point-based input components (e.g., a mouse, atouchpad, a trackball, a joystick, a motion sensor, or another pointinginstrument), tactile input components (e.g., a physical button, a touchscreen that provides location and/or force of touches or touch gestures,or other tactile input components), audio input components (e.g., amicrophone), and the like.

Communication may be implemented using a wide variety of technologies.The I/O components 1450 may include communication components 964operable to couple the machine 1400 to a network 1480 or devices 1470via a coupling 1482 and a coupling 1472, respectively. For example, thecommunication components 1464 may include a network interface componentor another suitable device to interface with the network 1480. Infurther examples, the communication components 1464 may include wiredcommunication components, wireless communication components, cellularcommunication components, and other communication components to providecommunication via other modalities. The devices 1470 may be anothermachine or any of a wide variety of peripheral devices (e.g., aperipheral device coupled via a universal serial bus (USB)). Forexample, as noted above, the machine 900 may correspond to any one ofthe remote computing device 106, the access management system 110, thecompute service manager 112, the execution platform 114, the accessmanagement system 118, the Web proxy 120, and the devices 1470 mayinclude any other of these systems and devices.

The various memories (e.g., 1430, 1432, 1434, and/or memory of theprocessor(s) 1410 and/or the storage unit 1436) may store one or moresets of instructions 1416 and data structures (e.g., software) embodyingor utilized by any one or more of the methodologies or functionsdescribed herein. These instructions 1416, when executed by theprocessor(s) 1410, cause various operations to implement the disclosedembodiments.

As used herein, the terms “machine-storage medium,” “device-storagemedium,” and “computer-storage medium” mean the same thing and may beused interchangeably in this disclosure. The terms refer to a single ormultiple storage devices and/or media (e.g., a centralized ordistributed database, and/or associated caches and servers) that storeexecutable instructions and/or data. The terms shall accordingly betaken to include, but not be limited to, solid-state memories, andoptical and magnetic media, including memory internal or external toprocessors. Specific examples of machine-storage media, computer-storagemedia, and/or device-storage media include non-volatile memory,including by way of example semiconductor memory devices, e.g., erasableprogrammable read-only memory (EPROM), electrically erasableprogrammable read-only memory (EEPROM), field-programmable gate arrays(FPGAs), and flash memory devices; magnetic disks such as internal harddisks and removable disks; magneto-optical disks; and CD-ROM and DVD-ROMdisks. The terms “machine-storage media,” “computer-storage media,” and“device-storage media” specifically exclude carrier waves, modulateddata signals, and other such media, at least some of which are coveredunder the term “signal medium” discussed below.

In various example embodiments, one or more portions of the network 980may be an ad hoc network, an intranet, an extranet, a virtual privatenetwork (VPN), a local-area network (LAN), a wireless LAN (WLAN), awide-area network (WAN), a wireless WAN (WWAN), a metropolitan-areanetwork (MAN), the Internet, a portion of the Internet, a portion of thepublic switched telephone network (PSTN), a plain old telephone service(POTS) network, a cellular telephone network, a wireless network, aWi-Fi® network, another type of network, or a combination of two or moresuch networks. For example, the network 980 or a portion of the network1480 may include a wireless or cellular network, and the coupling 1482may be a Code Division Multiple Access (CDMA) connection, a GlobalSystem for Mobile communications (GSM) connection, or another type ofcellular or wireless coupling. In this example, the coupling 982 mayimplement any of a variety of types of data transfer technology, such asSingle Carrier Radio Transmission Technology (1×RTT), Evolution-DataOptimized (EVDO) technology, General Packet Radio Service (GPRS)technology, Enhanced Data rates for GSM Evolution (EDGE) technology,third Generation Partnership Project (3GPP) including 3G, fourthgeneration wireless (4G) networks, Universal Mobile TelecommunicationsSystem (UMTS), High-Speed Packet Access (HSPA), WorldwideInteroperability for Microwave Access (WiMAX), Long Term Evolution (LTE)standard, others defined by various standard-setting organizations,other long-range protocols, or other data transfer technology.

The instructions 1416 may be transmitted or received over the network1480 using a transmission medium via a network interface device (e.g., anetwork interface component included in the communication components1464) and utilizing any one of a number of well-known transfer protocols(e.g., hypertext transfer protocol (HTTP)). Similarly, the instructions1416 may be transmitted or received using a transmission medium via thecoupling 1472 (e.g., a peer-to-peer coupling) to the devices 1470. Theterms “transmission medium” and “signal medium” mean the same thing andmay be used interchangeably in this disclosure. The terms “transmissionmedium” and “signal medium” shall be taken to include any intangiblemedium that is capable of storing, encoding, or carrying theinstructions 1416 for execution by the machine 1400, and include digitalor analog communications signals or other intangible media to facilitatecommunication of such software. Hence, the terms “transmission medium”and “signal medium” shall be taken to include any form of modulated datasignal, carrier wave, and so forth. The term “modulated data signal”means a signal that has one or more of its characteristics set orchanged in such a manner as to encode information in the signal.

The terms “machine-readable medium,” “computer-readable medium,” and“device-readable medium” mean the same thing and may be usedinterchangeably in this disclosure. The terms are defined to includeboth machine-storage media and transmission media. Thus, the termsinclude both storage devices/media and carrier waves/modulated datasignals.

The various operations of example methods described herein may beperformed, at least partially, by one or more processors that aretemporarily configured (e.g., by software) or permanently configured toperform the relevant operations. Similarly, the methods described hereinmay be at least partially processor-implemented. For example, at leastsome of the operations of the methods described herein may be performedby one or more processors. The performance of certain of the operationsmay be distributed among the one or more processors, not only residingwithin a single machine, but also deployed across a number of machines.In some example embodiments, the processor or processors may be locatedin a single location (e.g., within a home environment, an officeenvironment, or a server farm), while in other embodiments theprocessors may be distributed across a number of locations.

Although the embodiments of the present disclosure have been describedwith reference to specific example embodiments, it will be evident thatvarious modifications and changes may be made to these embodimentswithout departing from the broader scope of the inventive subjectmatter. Accordingly, the specification and drawings are to be regardedin an illustrative rather than a restrictive sense. The accompanyingdrawings that form a part hereof show, by way of illustration, and notof limitation, specific embodiments in which the subject matter may bepracticed. The embodiments illustrated are described in sufficientdetail to enable those skilled in the art to practice the teachingsdisclosed herein. Other embodiments may be used and derived therefrom,such that structural and logical substitutions and changes may be madewithout departing from the scope of this disclosure. This DetailedDescription, therefore, is not to be taken in a limiting sense, and thescope of various embodiments is defined only by the appended claims,along with the full range of equivalents to which such claims areentitled.

Such embodiments of the inventive subject matter may be referred toherein, individually and/or collectively, by the term “invention” merelyfor convenience and without intending to voluntarily limit the scope ofthis application to any single invention or inventive concept if morethan one is in fact disclosed. Thus, although specific embodiments havebeen illustrated and described herein, it should be appreciated that anyarrangement calculated to achieve the same purpose may be substitutedfor the specific embodiments shown. This disclosure is intended to coverany and all adaptations or variations of various embodiments.Combinations of the above embodiments, and other embodiments notspecifically described herein, will be apparent, to those of skill inthe art, upon reviewing the above description.

In this document, the terms “a” or “an” are used, as is common in patentdocuments, to include one or more than one, independent of any otherinstances or usages of “at least one” or “one or more.” In thisdocument, the term “or” is used to refer to a nonexclusive or, such that“A or B” includes “A but not B,” “B but not A,” and “A and B,” unlessotherwise indicated. In the appended claims, the terms “including” and“in which” are used as the plain-English equivalents of the respectiveterms “comprising” and “wherein.” Also, in the following claims, theterms “including” and “comprising” are open-ended; that is, a system,device, article, or process that includes elements in addition to thoselisted after such a term in a claim is still deemed to fall within thescope of that claim.

The following numbered examples are embodiments:

Example 1. A method comprising: receiving, by one or more processors, aquery directed at a data set; creating a query plan to execute thequery; based on a set of criteria, identifying a portion of the queryplan that is eligible for fragment processing; by a parent querycoordinator, executing the identified portion of the query plan on afirst batch of files of the data set to generate a first batch result;by a fragment query coordinator, executing the identified portion of thequery on a second batch of files of the data set to generate amaterialized result file; scanning the materialized result file togenerate scanned results; combining the first batch results and thescanned results to generate combined results; and executing remainingportion of the query plan on the combined results to generate a responseto the query.

Example 2. The method of example 1, further comprising: loading files ofthe data set into a first shared file queue as a continuous scanset;grouping a first set of files as the first batch and providing the firstbatch to the parent query coordinator; and grouping a second set offiles as the second batch and providing the second batch to the fragmentquery coordinator.

Example 3. The method of any of examples 1-2, further comprising:providing additional batches serially until all files in the continuousscanset have been provided.

Example 4. The method of any of examples 1-3, wherein the fragment querycoordinator loads the materialized result file in an output shared filequeue.

Example 5. The method of any of examples 1-4, wherein the fragment querycoordinator uses one or more fragment computing resources to execute theidentified portion of the query.

Example 6. The method of any of examples 1-5, wherein the number offragment computing resources changes during execution of the query.

Example 7. The method of any of examples 1-6, wherein the set ofcriteria includes whether an output of execution of the identifiedportion is less than an input of the identified portion.

Example 8. The method of any of examples 1-7, wherein the set ofcriteria includes whether the identified portion is executable by acomputing resource without communicating with another computingresource.

Example 9. The method of any of examples 1-8, wherein the query planincludes a plurality of operators and links connecting the operators,each link connecting a first and second operator of the plurality ofoperators and indicating whether the first operator is executable by acomputing resource without communicating with another computingresource.

Example 10. The method of any of examples 1-9, further comprising:aggregating the materialized result file with at least anothermaterialized result file; and wherein scanning the materialized resultfile to generate scanned results includes scanning the aggregatedmaterialized result files to generate the scanned results.

Example 11. A system comprising: one or more processors of a machine;and a memory storing instructions that, when executed by the one or moreprocessors, cause the machine to perform operations implementing any oneof example methods 1 to 10.

Example 12. A machine-readable storage device embodying instructionsthat, when executed by a machine, cause the machine to performoperations implementing any one of example methods 1 to 10.

What is claimed is:
 1. A method comprising: receiving, by one or moreprocessors, a query directed at a data set stored in a network-baseddatabase system; generating a query plan to execute the query;identifying a portion of the query plan that is eligible for fragmentprocessing based on an output-to-input ratio where input represents sizeof one or more input files for fragment processing and output representssize of an output file based on the one or more input file; executing,by a parent query coordinator using one or more computing resources of afirst set of computing resources assigned to the parent querycoordinator, the identified portion of the query plan on a first batchof files of the data set to generate a first batch result; transmittinginstructions to a fragment query coordinator for the fragment querycoordinator to execute the identified portion of the query on a secondbatch of files of the data set to generate the output file using asecond set of computing resources assigned to the fragment querycoordinator, the output file being stored in a storage location;scanning, by the parent query coordinator, the output file from thestorage location to generate a second batch result; combining the firstbatch result and the second batch result to generate combined results;and executing remaining portion of the query plan on the combinedresults to generate a response to the query.
 2. The method of claim 1,further comprising: loading files of the data set into a first sharedfile queue as a continuous scanset; grouping a first set of files as thefirst batch and providing the first batch to the parent querycoordinator; and grouping a second set of files as the second batch andproviding the second batch to the fragment query coordinator.
 3. Themethod of claim 2, further comprising: providing additional batchesserially until all files in the continuous scanset have been provided.4. The method of claim 1, wherein identifying the portion of the queryplan that is eligible for fragment processing is further based on a setof criteria.
 5. The method of claim 4, wherein the set of criteriaincludes a type of link connecting at least two operators of a pluralityof operators in the query plan.
 6. The method of claim 5, wherein eachlink connects a first and second operator of the plurality of operatorsand the type of link indicates whether the first operator is executableby a computing resource without communicating with another computingresource.
 7. The method of claim 4, wherein the set of criteria includeswhether the identified portion is executable by a computing resourcewithout communicating with another computing resource.
 8. A systemcomprising: one or more processors of a machine; and a memory storinginstructions that, when executed by the one or more processors, causethe machine to perform operations comprising: receiving a query directedat a data set stored in a network-based database system; generating aquery plan to execute the query; identifying a portion of the query planthat is eligible for fragment processing based on an output-to-inputratio where input represents size of one or more input files forfragment processing and output represents size of an output file basedon the one or more input file; executing, by a parent query coordinatorusing one or more computing resources of a first set of computingresources assigned to the parent query coordinator, the identifiedportion of the query plan on a first batch of files of the data set togenerate a first batch result; transmitting instructions to a fragmentquery coordinator for the fragment query coordinator to execute theidentified portion of the query on a second batch of files of the dataset to generate the output file using a second set of computingresources assigned to the fragment query coordinator, the output filebeing stored in a storage location; scanning, by the parent querycoordinator, the output file from the storage location to generate asecond batch result; combining the first batch result and the secondbatch result to generate combined results; and executing remainingportion of the query plan on the combined results to generate a responseto the query.
 9. The system of claim 8, the operations furthercomprising: loading files of the data set into a first shared file queueas a continuous scanset; grouping a first set of files as the firstbatch and providing the first batch to the parent query coordinator; andgrouping a second set of files as the second batch and providing thesecond batch to the fragment query coordinator.
 10. The system of claim9, the operations further comprising: providing additional batchesserially until all files in the continuous scanset have been provided.11. The system of claim 8, wherein identifying the portion of the queryplan that is eligible for fragment processing is further based on a setof criteria.
 12. The system of claim 11, wherein the set of criteriaincludes a type of link connecting at least two operators of a pluralityof operators in the query plan.
 13. The system of claim 12, wherein eachlink connects a first and second operator of the plurality of operatorsand the type of link indicates whether the first operator is executableby a computing resource without communicating with another computingresource.
 14. The system of claim 11, wherein the set of criteriaincludes whether the identified portion is executable by a computingresource without communicating with another computing resource.
 15. Anon-transitory machine-storage medium embodying instructions that, whenexecuted by a machine, cause the machine to perform operationscomprising: receiving a query directed at a data set stored in anetwork-based database system; generating a query plan to execute thequery; identifying a portion of the query plan that is eligible forfragment processing based on an output-to-input ratio where inputrepresents size of one or more input files for fragment processing andoutput represents size of an output file based on the one or more inputfile; executing, by a parent query coordinator using one or morecomputing resources of a first set of computing resources assigned tothe parent query coordinator, the identified portion of the query planon a first batch of files of the data set to generate a first batchresult; transmitting instructions to a fragment query coordinator forthe fragment query coordinator to execute the identified portion of thequery on a second batch of files of the data set to generate the outputfile using a second set of computing resources assigned to the fragmentquery coordinator, the output file being stored in a storage location;scanning, by the parent query coordinator, the output file from thestorage location to generate a second batch result; combining the firstbatch result and the second batch result to generate combined results;and executing remaining portion of the query plan on the combinedresults to generate a response to the query.
 16. The non-transitorymachine-storage medium of claim 15, further comprising: loading files ofthe data set into a first shared file queue as a continuous scanset;grouping a first set of files as the first batch and providing the firstbatch to the parent query coordinator; and grouping a second set offiles as the second batch and providing the second batch to the fragmentquery coordinator.
 17. The non-transitory machine-storage medium ofclaim 16, further comprising: providing additional batches seriallyuntil all files in the continuous scanset have been provided.
 18. Thenon-transitory machine-storage medium of claim 15, wherein identifyingthe portion of the query plan that is eligible for fragment processingis further based on a set of criteria.
 19. The non-transitorymachine-storage medium of claim 18, wherein the set of criteria includesa type of link connecting at least two operators of a plurality ofoperators in the query plan.
 20. The non-transitory machine-storagemedium of claim 19, wherein each link connects a first and secondoperator of the plurality of operators and the type of link indicateswhether the first operator is executable by a computing resource withoutcommunicating with another computing resource.
 21. The non-transitorymachine-storage medium of claim 18, wherein the set of criteria includeswhether the identified portion is executable by a computing resourcewithout communicating with another computing resource.